package com.kis.controller

import com.alibaba.fastjson.JSON
import com.kis.model.ResponseData
import com.kis.model.user.User
import com.kis.service.BaseService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController

/**
 * Created by wongloong on 16-12-5.
 */
@RestController
@RequestMapping("/user")
class UserController{
    @Autowired
    lateinit private var userService: BaseService<User, Int>

    @RequestMapping(method = arrayOf(RequestMethod.POST))
    fun saveOrUpdateUser(userJson: String): ResponseData = ResponseData(userService.saveOrUpdate(JSON.parseObject(userJson, User::class.java)))

}